home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / bsd / sys / termios.h < prev    next >
Text File  |  1995-02-14  |  8KB  |  250 lines

  1. /*
  2.  * Copyright (c) 1988, 1989 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)termios.h    7.22 (Berkeley) 5/7/91
  34.  */
  35.  
  36. /*
  37.  *  termios structure
  38.  */
  39. #ifndef _TERMIOS_H_
  40. #define _TERMIOS_H_
  41.  
  42. /* 
  43.  * Special Control Characters 
  44.  *
  45.  * Index into c_cc[] character array.
  46.  *
  47.  *    Name         Subscript    Enabled by 
  48.  */
  49. #define    VEOF        0                /* ICANON */
  50. #define    VEOL        1                /* ICANON */
  51. #define    VERASE        2                /* ICANON */
  52. #define VKILL        3                /* ICANON */
  53. #define VINTR        4                /* ISIG */
  54. #define VQUIT        5                /* ISIG */
  55. #define VSUSP        6                /* ISIG */
  56. #define VSTART        7                /* IXON, IXOFF */
  57. #define VSTOP        8                /* IXON, IXOFF */
  58. #define VMIN        9                /* !ICANON */
  59. #define VTIME        10                /* !ICANON */
  60.  
  61. #if defined(_NEXT_SOURCE)
  62. #define VWERASE     11                /* ICANON */
  63. #define VREPRINT     12                /* ICANON */
  64. #define VLNEXT        13                /* IEXTEN */
  65. #define VDISCARD    14                /* IEXTEN */
  66. #define VDSUSP        15                /* ISIG */
  67. #define VQUOTE        16                /* ICANON */
  68. #endif     /* _NEXT_SOURCE */
  69.  
  70. #define    NCCS        17
  71.  
  72. /*
  73.  * Input flags - software input processing
  74.  */
  75. #define    IGNBRK        0x00000001    /* ignore BREAK condition */
  76. #define    BRKINT        0x00000002    /* map BREAK to SIGINTR */
  77. #define    IGNPAR        0x00000004    /* ignore (discard) parity errors */
  78. #define    PARMRK        0x00000008    /* mark parity and framing errors */
  79. #define    INPCK        0x00000010    /* enable checking of parity errors */
  80. #define    ISTRIP        0x00000020    /* strip 8th bit off chars */
  81. #define    INLCR        0x00000040    /* map NL into CR */
  82. #define    IGNCR        0x00000080    /* ignore CR */
  83. #define    ICRNL        0x00000100    /* map CR to NL (ala CRMOD) */
  84. #define    IXON        0x00000200    /* enable output flow control */
  85. #define    IXOFF        0x00000400    /* enable input flow control */
  86.  
  87. #if defined(_NEXT_SOURCE)
  88. #define    IXANY        0x00000800    /* any char will restart after stop */
  89. #define IMAXBEL        0x00002000    /* ring bell on input queue full */
  90. #endif     /* _NEXT_SOURCE */
  91.  
  92. /*
  93.  * Output flags - software output processing
  94.  */
  95. #define    OPOST        0x00000001    /* enable following output processing */
  96. #if defined(_NEXT_SOURCE)
  97. #define ONLCR        0x00000002    /* map NL to CR-NL (ala CRMOD) */
  98.     /* use the same bits as old delay flags */
  99. #define    NLDELAY        0x00000300    /* \n delay */
  100. #define        NL0    0x00000000
  101. #define        NL1    0x00000100    /* tty 37 */
  102. #define        NL2    0x00000200    /* vt05 */
  103. #define        NL3    0x00000300
  104. #define    TBDELAY        0x00000c00    /* horizontal tab delay */
  105. #define        TAB0    0x00000000
  106. #define        TAB1    0x00000400    /* tty 37 */
  107. #define        TAB2    0x00000800
  108. #define    XTABS        0x00000c00    /* expand tabs on output */
  109. #define    CRDELAY        0x00003000    /* \r delay */
  110. #define        CR0    0x00000000
  111. #define        CR1    0x00001000    /* tn 300 */
  112. #define        CR2    0x00002000    /* tty 37 */
  113. #define        CR3    0x00003000    /* concept 100 */
  114. #define    VTDELAY        0x00004000    /* vertical tab delay */
  115. #define        FF0    0x00000000
  116. #define        FF1    0x00004000    /* tty 37 */
  117. #define    BSDELAY        0x00008000    /* \b delay */
  118. #define        BS0    0x00000000
  119. #define        BS1    0x00008000
  120. #define    ALLDELAY    (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY)
  121. #endif    /* _NEXT_SOURCE */
  122.  
  123. /*
  124.  * Control flags - hardware control of terminal
  125.  */
  126. #if defined(_NEXT_SOURCE)
  127. #define    CIGNORE        0x00000001    /* ignore control flags */
  128. #endif    /* _NEXT_SOURCE */
  129.  
  130. #define CSIZE        0x00000300    /* character size mask */
  131. #define     CS5            0x00000000        /* 5 bits (pseudo) */
  132. #define     CS6            0x00000100        /* 6 bits */
  133. #define     CS7            0x00000200        /* 7 bits */
  134. #define     CS8            0x00000300        /* 8 bits */
  135. #define CSTOPB        0x00000400    /* send 2 stop bits */
  136. #define CREAD        0x00000800    /* enable receiver */
  137. #define PARENB        0x00001000    /* parity enable */
  138. #define PARODD        0x00002000    /* odd parity, else even */
  139. #define HUPCL        0x00004000    /* hang up on last close */
  140. #define CLOCAL        0x00008000    /* ignore modem status lines */
  141.  
  142. #if defined(_NEXT_SOURCE)
  143. #define CSTOPB110    0x00010000
  144. #define PAR0        0x00020000    /* Space parity */
  145. #define PAR1        0x00040000    /* Mark parity */
  146. #endif    /* _NEXT_SOURCE */
  147.  
  148.  
  149. /* 
  150.  * "Local" flags - dumping ground for other state
  151.  *
  152.  * Warning: some flags in this structure begin with
  153.  * the letter "I" and look like they belong in the
  154.  * input flag.
  155.  */
  156.  
  157. #if defined(_NEXT_SOURCE)
  158. #define    ECHOKE        0x00000001    /* visual erase for line kill */
  159. #endif    /* _NEXT_SOURCE */
  160.  
  161. #define    ECHOE        0x00000002    /* visually erase chars */
  162. #define    ECHOK        0x00000004    /* echo NL after line kill */
  163. #define ECHO        0x00000008    /* enable echoing */
  164. #define    ECHONL        0x00000010    /* echo NL even if ECHO is off */
  165. #define    ICANON        0x00000020    /* canonicalize input lines */
  166. #define    ISIG        0x00000040    /* enable signals INTR, QUIT, [D]SUSP */
  167. #define    IEXTEN        0x00000080    /* enable DISCARD and LNEXT */
  168.  
  169. #if defined(_NEXT_SOURCE)
  170. #define    ECHOCRT        0x00000100    /* visual erase mode for crt */
  171. #define    ECHOPRT        0x00000200    /* visual erase mode for hardcopy */
  172. #define ECHOCTL      0x00000400    /* echo control chars as ^(Char) */
  173. #define ALTWERASE    0x00000800    /* use alternate WERASE algorithm */
  174. #define    MDMBUF        0x00100000    /* flow control output via Carrier */
  175. #endif    /* _NEXT_SOURCE */
  176.  
  177. #define TOSTOP        0x00400000    /* stop background jobs from output */
  178.  
  179. #if defined(_NEXT_SOURCE)
  180. #define XLCASE        0x04000000
  181. #define XEUCBKSP    0x08000000
  182. #endif    /* _NEXT_SOURCE */
  183.  
  184. #define    NOFLSH        0x80000000    /* don't flush after interrupt */
  185.  
  186. typedef unsigned long    tcflag_t;
  187. typedef unsigned char    cc_t;
  188. typedef char        speed_t;
  189.  
  190. struct termios {
  191.     tcflag_t    c_iflag;    /* input flags */
  192.     tcflag_t    c_oflag;    /* output flags */
  193.     tcflag_t    c_cflag;    /* control flags */
  194.     tcflag_t    c_lflag;    /* local flags */
  195.     cc_t        c_cc[NCCS];    /* control chars */
  196.     speed_t        c_ispeed;    /* input speed */
  197.     speed_t        c_ospeed;    /* output speed */
  198. };
  199.  
  200. /* 
  201.  * Commands passed to tcsetattr() for setting the termios structure.
  202.  */
  203. #define    TCSANOW        0        /* make change immediate */
  204. #define    TCSADRAIN    1        /* drain output, then change */
  205. #define    TCSAFLUSH    2        /* drain output, flush input */
  206.  
  207. #if defined(_NEXT_SOURCE)
  208. #define TCSASOFT    0x10        /* flag - don't alter h.w. state */
  209. #endif    /* _NEXT_SOURCE */
  210.  
  211. /*
  212.  * Standard speeds
  213.  */
  214. #import <sys/ttydev.h>
  215.  
  216. #ifndef KERNEL
  217.  
  218. #ifdef __STDC__
  219. speed_t    cfgetispeed(const struct termios *);
  220. speed_t    cfgetospeed(const struct termios *);
  221. int    cfsetispeed(struct termios *, int);
  222. int    cfsetospeed(struct termios *, int);
  223. int    tcdrain(int);
  224. int    tcflow(int, int);
  225. int    tcflush(int, int);
  226. int    tcgetattr(int, struct termios *);
  227. int    tcsendbreak(int, int);
  228. int    tcsetattr(int, int, const struct termios *);
  229.  
  230. #if defined(_NEXT_SOURCE)
  231. void    cfmakeraw(struct termios *);
  232. void    cfsetspeed(struct termios *, int);
  233. #endif    /* _NEXT_SOURCE */
  234. #endif /* __STDC__ */
  235.  
  236. #define    TCIFLUSH    1
  237. #define    TCOFLUSH    2
  238. #define TCIOFLUSH    3
  239. #define    TCOOFF        1
  240. #define    TCOON        2
  241. #define TCIOFF        3
  242. #define TCION        4
  243.  
  244. #endif /* !KERNEL */
  245.  
  246. /*
  247.  * END OF PROTECTED INCLUDE.
  248.  */
  249. #endif /* !_TERMIOS_H_ */
  250.